<?php
function login($login_username, $login_password) {
	
	$host=DB_HOST; // Host name
	$username=DB_USER; // Mysql username
	$password=DB_PASSWORD; // Mysql password
	$db_name=DB_NAME; // Database name
		mysql_connect("$host", "$username", "$password")or die("cannot connect");
	mysql_select_db("$db_name")or die("cannot select DB");
	
	
	$tbl_name="users"; // Table name
	$sql="SELECT * FROM $tbl_name WHERE user_name='$login_username' and user_password='$login_password'";
	$result=mysql_query($sql);
	
	// Mysql_num_row is counting table row
	$count=mysql_num_rows($result);
	
	// If result matched $myusername and $mypassword, table row must be 1 row
	if($count==1){
		return $username;
	}
}
?>
